class CommentTask < ActiveRecord::Base
  set_table_name 'comment_task'
  set_primary_key 'comment_task_id'

  belongs_to :task,
             :class_name  => 'Task',
	     :foreign_key => 'task_fk';

  belongs_to :user,
             :class_name  => 'User',
	     :foreign_key => 'user_fk';

  validates_presence_of :user_fk, :task_fk, :content;

  def validate 
      if (time_worked.to_s !~ /^\d+$/) 
          errors.add('time_worked','has an invalid format. Should contain only numbers');
      end
  end

end
